<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page session="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Categories</title>
	<link rel="stylesheet" href="<c:url value="/resources/blueprint/screen.css" />" type="text/css" media="screen, projection">
	<link rel="stylesheet" href="<c:url value="/resources/blueprint/print.css" />" type="text/css" media="print">
	<!--[if lt IE 8]>
		<link rel="stylesheet" href="<c:url value="/resources/blueprint/ie.css" />" type="text/css" media="screen, projection">
	<![endif]-->
</head>
<body>
<div class="container">
    <%@include file="../common/header.jsp" %>
	<h2>Category list</h2>
	<div class="span-12 last">	
		<form:form modelAttribute="category" action="delete" method="post">
			<table width="100%" border="1" cellpadding="2" cellspacing="0">
                <thead>
                    <tr>
                     	<th>&nbsp;</th>
						<th>Name</th>
						<th>Description</th>
						<th>Sort order</th>
						<th>ACtion</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${categories}" var="category">
					<tr>
						<td><input type="checkbox" name="id" value="${category.id}"/></td>
						<td> <c:out value="${category.name}"/> </td>
						<td> <c:out value="${category.description}"/> </td>
						<td> <c:out value="${category.sortorder}"/> </td>
						<td><a href="${category.id}">Edit</a></td>
					</tr>
					</c:forEach>
				</tbody>
			</table>
			<input type="button" value="Insert" onclick="window.location.href='create';"/> &nbsp;&nbsp; <input type="submit" value="Delete selected category"/>
		</form:form>
		</div>
    <%@include file="../common/footer.jsp" %>
</div>
</body>
</html>